package com.mydomain.Bodega;

import com.mydomain.Bodega.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("invComprasHome")
public class InvComprasHome extends EntityHome<InvCompras> {

	@In(create = true)
	SubdepartamentoHome subdepartamentoHome;

	public void setInvComprasCmpCodigo(Long id) {
		setId(id);
	}

	public Long getInvComprasCmpCodigo() {
		return (Long) getId();
	}

	@Override
	protected InvCompras createInstance() {
		InvCompras invCompras = new InvCompras();
		return invCompras;
	}

	public void wire() {
		getInstance();
		Subdepartamento subdepartamento = subdepartamentoHome
				.getDefinedInstance();
		if (subdepartamento != null) {
			getInstance().setSubdepartamento(subdepartamento);
		}
	}

	public boolean isWired() {
		return true;
	}

	public InvCompras getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<InvDetalle> getInvDetalles() {
		return getInstance() == null ? null : new ArrayList<InvDetalle>(
				getInstance().getInvDetalles());
	}

}
